﻿using PRJ1109.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace project1113
{/// <summary>
/// 由于失误，这里没用
/// </summary>
    public class ViewHelper
    {

        private Frame Frame; // = mainFram
        private string currentFrameName;

        //private WaitPage page = new WaitPage();
        public ViewHelper(Frame frame)
        {
            Frame = frame;
        }
        public void LoadPage(string pageName)
        {
            if (currentFrameName == pageName)
            {
                return;
            }
            else
            {
                //释放前一个页面的内容
                Frame.Content = null;

                switch (pageName)
                {
                    case "TimePage":
                        WaitPage waitPage = new WaitPage();
                        if (waitPage != null)
                            Frame.Navigate(waitPage);
                        break;
                    case "ExecutePage":
                        Joy joy = new Joy();
                        if (joy != null)
                            Frame.Navigate(new Joy());
                        break;
                    case "Emergence":
                        Scare scare = new Scare();
                        if (scare != null) Frame.Navigate(new Scare());
                        break;
                    case "ChatPage":
                        Happy happy = new Happy();
                        if (happy != null) Frame.Navigate(happy);
                        break;
                    case "Hello":
                        Hello hello = new Hello();
                        if (hello != null) Frame.Navigate(hello);
                        break;
                    default:
                        break;
                }
                currentFrameName = pageName;
            }
        }
    } 
}